/**
 * 
 */
package org.insia.smartposse.metier.webservice;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

import org.insia.smartposse.metier.Category;
import org.insia.smartposse.metier.CategoryTheme;

/**
 * @author raguerri
 * @since 18 avr. 07
 * @version 0.0.1
 * 
 */
public class LightCategory 
implements Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = 4900299918831742632L;
	private long id;
	private String label;
	private long parent;
	private List<LightCategoryTheme> themeSet = new ArrayList<LightCategoryTheme>();
	
	/**
	 * 
	 *
	 */
	public LightCategory() {}
	
	/**
	 * 
	 * @param cate
	 */
	public LightCategory(Category cate) {
		id = cate.getId();
		label = cate.getLabel();
		parent = cate.getParent() != null ? cate.getParent().getId() : -1L ;
		
		if (cate.getThemeSet().size() != 0) {
			for (CategoryTheme ctheme : cate.getThemeSet()) {
				themeSet.add(ctheme.setLight());
			}
		}
		
	}
	
	/**
	 * @return the id
	 */
	public long getId() {
		return id;
	}
	/**
	 * @return the label
	 */
	public String getLabel() {
		return label;
	}
	/**
	 * @return the parent
	 */
	public long getParent() {
		return parent;
	}
	/**
	 * @return the themeSet
	 */
	public List<LightCategoryTheme> getThemeSet() {
		return themeSet;
	}
	/**
	 * @param id the id to set
	 */
	public void setId(long id) {
		this.id = id;
	}
	/**
	 * @param label the label to set
	 */
	public void setLabel(String label) {
		this.label = label;
	}
	/**
	 * @param parent the parent to set
	 */
	public void setParent(long parent) {
		this.parent = parent;
	}
	/**
	 * @param themeSet the themeSet to set
	 */
	public void setThemeSet(List<LightCategoryTheme> themeSet) {
		this.themeSet = themeSet;
	}	
}
